<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});


\Route::group(['prefix' => 'api/file'], function() {
    /**
     * 上传文件
     * 访问地址: GET: /api/file/upload
     * 控制器位置: app\Http\Controller\Common\FileController.php
     */
    Route::post('upload', 'Common\FileController@upload');

    /**
     * 上传文件
     * 访问地址: GET: /api/file/uploadMedia
     * 控制器位置: app\Http\Controller\Common\FileController.php
     */
    Route::post('uploadMedia', 'Common\FileController@upload_media');

    /**
     * 上传附件
     * 访问地址: GET: /api/file/uploadZip
     * 控制器位置: app\Http\Controller\Common\FileController.php
     */
    Route::post('uploadZip', 'Common\FileController@uploadZip');

    /**
     * 获取文件
     * 访问地址: GET: /api/file/obtain
     * 控制器位置: app\Http\Controller\Common\FileController.php
     */
    Route::get('obtain/{fileModel}', 'Common\FileController@obtain');

    /**
     * 发送短信
     * 访问地址: GET: /api/sendSms
     * 控制器位置: app\Http\Controller\Common\SmsController.php
     */
    Route::post('sendSms', 'Common\SmsController@sendSms');

});

Route::group(['prefix'=>'api/public'],function(){
    /**
     * 配置
     * 访问地址: GET: /api/public/conf
     * 控制器位置: app\Http\Controller\Common\CommonController.php
     */
    Route::post('conf', 'Common\CommonController@conf');
});

Route::group(['prefix' => '/'], function() {
    // 平台
    require_once __DIR__ . DIRECTORY_SEPARATOR . 'api' . DIRECTORY_SEPARATOR . 'admin/admin.php';
    // 前端
    require_once __DIR__ . DIRECTORY_SEPARATOR . 'api' . DIRECTORY_SEPARATOR . 'home/main.php';
});
